home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 May: Tool Chest / Dev.CD May 98 TC.toast / Tool Chest / Development Kits / HyperCard Related / APDA HyperCard Toolkits / HyperCard CTB Toolkit 1.0b2 / Source Code / CTBBreak.p < prev    next >
Encoding:
Text File  |  1995-02-07  |  1.5 KB  |  70 lines  |  [TEXT/MPS ]

  1. (*
  2.     CTBBreak [ticks] -- Issue a break for ticks 60ths of a second; if ticks is left off, issue a break for
  3.         three seconds.
  4.  
  5.     To compile and link this file using Macintosh Programmer's Workshop,
  6.  
  7.         pascal -w CTBBreak.p
  8.         link -m ENTRYPOINT -o HyperCommands -rt XCMD=2761 -sn Main=CTBBreak ∂
  9.             CTBBreak.p.o "{MPW}"Libraries:interface.o "{MPW}"Libraries:Libraries:HyperXLib.o
  10.  
  11.     © Copyright 1990 by Apple Computer, Inc.
  12.  
  13.     Initial coding 2/90 by Harry R. Chesley.
  14. *)
  15.  
  16. {$R-}
  17.  
  18. {$S CTBBreak }     { Segment name must be the same as the command name. }
  19.  
  20. unit DummyUnit;
  21.  
  22. interface
  23.  
  24. uses MemTypes, QuickDraw, OSIntf, ToolIntf, CTBUtils, FTIntf, CMIntf, TMIntf, CRMIntf, HyperXCmd;
  25.  
  26. procedure EntryPoint(paramPtr: XCmdPtr);
  27.     
  28. implementation
  29.  
  30. procedure CTBBreak(paramPtr: XCmdPtr); forward;
  31.  
  32. procedure EntryPoint(paramPtr: XCmdPtr);
  33.  
  34.     begin
  35.         CTBBreak(paramPtr);
  36.     end;
  37.  
  38. procedure CTBBreak(paramPtr: XCmdPtr);
  39.  
  40.     {$I CTBUtil.inc}
  41.  
  42.     var ticks: longInt;
  43.  
  44.     procedure Fail(errMsg: Str255); { set theResult and quit }
  45.         begin
  46.             paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
  47.             exit(CTBBreak);
  48.         end;
  49.  
  50.     begin
  51.         { Check the number of parameters. }
  52.         if paramPtr^.paramCount > 1 then Fail('Invalid parameter count');
  53.  
  54.         { Figure out how long to break for. }
  55.         if ParmPresent(1) then ticks := GetLongParm(1)
  56.         else ticks := 180;
  57.  
  58.         { Make sure the Comm Toolbox is present. }
  59.         CTBReady;
  60.         { And a connection tool is here. }
  61.         EnsurePresent(connectionTool);
  62.         { And open. }
  63.         EnsureOpen;
  64.  
  65.         { Break. }
  66.         CMBreak(Globals^^.connHand,ticks,false,nil);
  67.     end;
  68.  
  69. end.
  70.